package morenoapp.model.tool;

import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import morenoapp.model.meta.MethodGetter;
import morenoapp.model.view2.MorenoView2Data;

/**
 *
 * @author dmitry.mamonov
 */
public class GenerateImpl {
    public static void main(String[] args) throws IOException {
        Class<?> _data = MorenoView2Data.class;

        TreeMap<String, Method> sortedMethods = new TreeMap();
        for (Method m : _data.getMethods()) {
            String key = "";
            for (Annotation ann : m.getAnnotations()) {
                key += ann.getClass().getSimpleName() + ",";
            }
            key += m.getName();
            if (m.getName().equals("addPropertyChangeListener") == false &&
                    m.getName().equals("removePropertyChangeListener") == false) {
                sortedMethods.put(key, m);
            }
        }

        List<String> fieldsList = new ArrayList<String>();
        for (Method m : sortedMethods.values()) {
            if (m.getAnnotation(MethodGetter.class)!=null){
                String property = GenerateWrapper.propByGet(m.getName());
                String line = String.format("    protected %s %s;",
                        m.getReturnType().getSimpleName(),
                        property);
                fieldsList.add(line);
                System.out.println(line);
            }
        }
        
        for (Method m : sortedMethods.values()) {
            if (m.getAnnotation(MethodGetter.class)!=null){
                
            }
        }


    }
}
